package com.wnxy.member.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/member")
@Slf4j
public class MemberController {

    @Value("${server.port}")
    private int port;

    /**
     * 访问地址： http://localhost:9000/member/100
     */
    @GetMapping("/{id}")
    public String findOne(@PathVariable("id") String id) throws InterruptedException {
        log.info("根据会员id查询：{},端口：{}",id,port);
        return "返回Member会员信息";
    }

    @GetMapping("/timeout")
    public String timeout() {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "超时方法";
    }
}
